<?php
class TCountryList extends TTemplateControl{
	public function onLoad($param){
		parent::onLoad($param) ;
		
		/**
		* Initialize the Country ISO code and Name in a 2 dimentional array
		*/
		$countryList[] = array( "Value" => "AD", "Text" => "Andorra" );
		$countryList[] = array( "Value" => "AE" , "Text" => "United Arab Emirates" );
		$countryList[] = array( "Value" => "AF" , "Text" => "Afghanistan" );
		$countryList[] = array( "Value" => "AG" , "Text" => "Antigua & Barbuda" );
		$countryList[] = array( "Value" => "AI" , "Text" => "Anguilla" );
		$countryList[] = array( "Value" => "AL" , "Text" => "Albania" );
		$countryList[] = array( "Value" => "AM" , "Text" => "Armenia" );
		$countryList[] = array( "Value" => "AN" , "Text" => "Netherlands Antilles" );
		$countryList[] = array( "Value" => "AO" , "Text" => "Angola" );
		$countryList[] = array( "Value" => "AQ" , "Text" => "Antarctica" );
		$countryList[] = array( "Value" => "AR" , "Text" => "Argentina" );
		$countryList[] = array( "Value" => "AS" , "Text" => "Samoa (American)" );
		$countryList[] = array( "Value" => "AT" , "Text" => "Austria" );
		$countryList[] = array( "Value" => "AU" , "Text" => "Australia" );
		$countryList[] = array( "Value" => "AW" , "Text" => "Aruba" );
	//	$countryList[] = array( "Value" => "AX" , "Text" => "Aaland Islands" );
		$countryList[] = array( "Value" => "AZ" , "Text" => "Azerbaijan" );
		$countryList[] = array( "Value" => "BA" , "Text" => "Bosnia & Herzegovina" );
		$countryList[] = array( "Value" => "BB" , "Text" => "Barbados" );
		$countryList[] = array( "Value" => "BD" , "Text" => "Bangladesh" );
		$countryList[] = array( "Value" => "BE" , "Text" => "Belgium" );
		$countryList[] = array( "Value" => "BF" , "Text" => "Burkina Faso" );
		$countryList[] = array( "Value" => "BG" , "Text" => "Bulgaria" );
		$countryList[] = array( "Value" => "BH" , "Text" => "Bahrain" );
		$countryList[] = array( "Value" => "BI" , "Text" => "Burundi" );
		$countryList[] = array( "Value" => "BJ" , "Text" => "Benin" );
		$countryList[] = array( "Value" => "BM" , "Text" => "Bermuda" );
		$countryList[] = array( "Value" => "BN" , "Text" => "Brunei" );
		$countryList[] = array( "Value" => "BO" , "Text" => "Bolivia" );
		$countryList[] = array( "Value" => "BR" , "Text" => "Brazil" );
		$countryList[] = array( "Value" => "BS" , "Text" => "Bahamas" );
		$countryList[] = array( "Value" => "BT" , "Text" => "Bhutan" );
		$countryList[] = array( "Value" => "BW" , "Text" => "Botswana" );
		$countryList[] = array( "Value" => "BY" , "Text" => "Belarus" );
		$countryList[] = array( "Value" => "BZ" , "Text" => "Belize" );
		$countryList[] = array( "Value" => "CA" , "Text" => "Canada" );
	//	$countryList[] = array( "Value" => "CC" , "Text" => "Cocos (Keeling) Islands" );
	//	$countryList[] = array( "Value" => "CD" , "Text" => "Congo (Dem. Rep.)" );
		$countryList[] = array( "Value" => "CF" , "Text" => "Central African Rep." );
		$countryList[] = array( "Value" => "CG" , "Text" => "Congo (Rep.)" );
		$countryList[] = array( "Value" => "CH" , "Text" => "Switzerland" );
		$countryList[] = array( "Value" => "CI" , "Text" => "Cote d'Ivoire" );
		$countryList[] = array( "Value" => "CK" , "Text" => "Cook Islands" );
		$countryList[] = array( "Value" => "CL" , "Text" => "Chile" );
		$countryList[] = array( "Value" => "CM" , "Text" => "Cameroon" );
		$countryList[] = array( "Value" => "CN" , "Text" => "China" );
		$countryList[] = array( "Value" => "CO" , "Text" => "Colombia" );
		$countryList[] = array( "Value" => "CR" , "Text" => "Costa Rica" );
		$countryList[] = array( "Value" => "CU" , "Text" => "Cuba" );
		$countryList[] = array( "Value" => "CV" , "Text" => "Cape Verde" );
		$countryList[] = array( "Value" => "CX" , "Text" => "Christmas Island" );
		$countryList[] = array( "Value" => "CY" , "Text" => "Cyprus" );
		$countryList[] = array( "Value" => "CZ" , "Text" => "Czech Republic" );
		$countryList[] = array( "Value" => "DE" , "Text" => "Germany" );	
		$countryList[] = array( "Value" => "DJ" , "Text" => "Djibouti" );
		$countryList[] = array( "Value" => "DK" , "Text" => "Denmark" );	 
		$countryList[] = array( "Value" => "DM" , "Text" => "Dominica" );
		$countryList[] = array( "Value" => "DO" , "Text" => "Dominican Republic" );
		$countryList[] = array( "Value" => "DZ" , "Text" => "Algeria" );
		$countryList[] = array( "Value" => "EC" , "Text" => "Ecuador" );
		$countryList[] = array( "Value" => "EE" , "Text" => "Estonia" );
		$countryList[] = array( "Value" => "EG" , "Text" => "Egypt" );
		$countryList[] = array( "Value" => "EH" , "Text" => "Western Sahara" );
		$countryList[] = array( "Value" => "ER" , "Text" => "Eritrea" );
		$countryList[] = array( "Value" => "ES" , "Text" => "Spain" );
		$countryList[] = array( "Value" => "ET" , "Text" => "Ethiopia" );
		$countryList[] = array( "Value" => "FI" , "Text" => "Finland" );
		$countryList[] = array( "Value" => "FJ" , "Text" => "Fiji" );
		$countryList[] = array( "Value" => "FK" , "Text" => "Falkland Islands" );
		$countryList[] = array( "Value" => "FM" , "Text" => "Micronesia" );
		$countryList[] = array( "Value" => "FO" , "Text" => "Faroe Islands" );		
		$countryList[] = array( "Value" => "FR" , "Text" => "France" );
		$countryList[] = array( "Value" => "GA" , "Text" => "Gabon" );
		$countryList[] = array( "Value" => "GB" , "Text" => "Britain (UK)" );
		$countryList[] = array( "Value" => "GD" , "Text" => "Grenada" );
		$countryList[] = array( "Value" => "GE" , "Text" => "Georgia" );
	//	$countryList[] = array( "Value" => "GF" , "Text" => "French Guiana" );		
		$countryList[] = array( "Value" => "GG" , "Text" => "Guernsey" );
		$countryList[] = array( "Value" => "GH" , "Text" => "Ghana" );
		$countryList[] = array( "Value" => "GI" , "Text" => "Gibraltar" );
		$countryList[] = array( "Value" => "GL" , "Text" => "Greenland" );
		$countryList[] = array( "Value" => "GM" , "Text" => "Gambia" );
		$countryList[] = array( "Value" => "GN" , "Text" => "Guinea" );
	//	$countryList[] = array( "Value" => "GP" , "Text" => "Guadeloupe" );
		$countryList[] = array( "Value" => "GQ" , "Text" => "Equatorial Guinea" );
		$countryList[] = array( "Value" => "GR" , "Text" => "Greece" );
		$countryList[] = array( "Value" => "GS" , "Text" => "South Georgia & the South Sandwich Islands" );
		$countryList[] = array( "Value" => "GT" , "Text" => "Guatemala" );
		$countryList[] = array( "Value" => "GU" , "Text" => "Guam" );
		$countryList[] = array( "Value" => "GW" , "Text" => "Guinea-Bissau" );
		$countryList[] = array( "Value" => "GY" , "Text" => "Guyana" );
		$countryList[] = array( "Value" => "HK" , "Text" => "Hong Kong" );
		$countryList[] = array( "Value" => "HN" , "Text" => "Honduras" );
		$countryList[] = array( "Value" => "HR" , "Text" => "Croatia" );
		$countryList[] = array( "Value" => "HT" , "Text" => "Haiti" );
		$countryList[] = array( "Value" => "HU" , "Text" => "Hungary" );
		$countryList[] = array( "Value" => "ID" , "Text" => "Indonesia" );
		$countryList[] = array( "Value" => "IE" , "Text" => "Ireland" );
		$countryList[] = array( "Value" => "IL" , "Text" => "Israel" );
		$countryList[] = array( "Value" => "IM" , "Text" => "Isle of Man" );
		$countryList[] = array( "Value" => "IN" , "Text" => "India" );
		$countryList[] = array( "Value" => "IO" , "Text" => "British Indian Ocean Territory" );
		$countryList[] = array( "Value" => "IQ" , "Text" => "Iraq" );
		$countryList[] = array( "Value" => "IR" , "Text" => "Iran" );
		$countryList[] = array( "Value" => "IS" , "Text" => "Iceland" );
		$countryList[] = array( "Value" => "IT" , "Text" => "Italy" );
		$countryList[] = array( "Value" => "JE" , "Text" => "Jersey" );
		$countryList[] = array( "Value" => "JM" , "Text" => "Jamaica" );
		$countryList[] = array( "Value" => "JO" , "Text" => "Jordan" );
		$countryList[] = array( "Value" => "JP" , "Text" => "Japan" );
		$countryList[] = array( "Value" => "KE" , "Text" => "Kenya" );
		$countryList[] = array( "Value" => "KG" , "Text" => "Kyrgyzstan" );
		$countryList[] = array( "Value" => "KH" , "Text" => "Cambodia" );
		$countryList[] = array( "Value" => "KI" , "Text" => "Kiribati" );
		$countryList[] = array( "Value" => "KM" , "Text" => "Comoros" );
		$countryList[] = array( "Value" => "KN" , "Text" => "St Kitts & Nevis" );					
		$countryList[] = array( "Value" => "KP" , "Text" => "Korea (North)" );	        
		$countryList[] = array( "Value" => "KR" , "Text" => "Korea (South)" );		
		$countryList[] = array( "Value" => "KW" , "Text" => "Kuwait" );
		$countryList[] = array( "Value" => "KY" , "Text" => "Cayman Islands" );
		$countryList[] = array( "Value" => "KZ" , "Text" => "Kazakhstan" );
		$countryList[] = array( "Value" => "LA" , "Text" => "Laos" );
		$countryList[] = array( "Value" => "LB" , "Text" => "Lebanon" );
		$countryList[] = array( "Value" => "LC" , "Text" => "St Lucia" );
		$countryList[] = array( "Value" => "LI" , "Text" => "Liechtenstein" );			
		$countryList[] = array( "Value" => "LK" , "Text" => "Sri Lanka" );
		$countryList[] = array( "Value" => "LR" , "Text" => "Liberia" );
		$countryList[] = array( "Value" => "LS" , "Text" => "Lesotho" );
		$countryList[] = array( "Value" => "LT" , "Text" => "Lithuania" );
		$countryList[] = array( "Value" => "LU" , "Text" => "Luxembourg" );
		$countryList[] = array( "Value" => "LV" , "Text" => "Latvia" );
		$countryList[] = array( "Value" => "LY" , "Text" => "Libya" );
		$countryList[] = array( "Value" => "MA" , "Text" => "Morocco" );
		$countryList[] = array( "Value" => "MC" , "Text" => "Monaco" );
		$countryList[] = array( "Value" => "MD" , "Text" => "Moldova" );
	//	$countryList[] = array( "Value" => "ME" , "Text" => "Montenegro" );
		$countryList[] = array( "Value" => "MG" , "Text" => "Madagascar" );
		$countryList[] = array( "Value" => "MH" , "Text" => "Marshall Islands" );
		$countryList[] = array( "Value" => "MK" , "Text" => "Macedonia" );
		$countryList[] = array( "Value" => "ML" , "Text" => "Mali" );
		$countryList[] = array( "Value" => "MM" , "Text" => "Myanmar (Burma)" );
		$countryList[] = array( "Value" => "MN" , "Text" => "Mongolia" );
		$countryList[] = array( "Value" => "MO" , "Text" => "Macau" );
		$countryList[] = array( "Value" => "MP" , "Text" => "Northern Mariana Islands" );
	//	$countryList[] = array( "Value" => "MQ" , "Text" => "Martinique" );
		$countryList[] = array( "Value" => "MR" , "Text" => "Mauritania" );
		$countryList[] = array( "Value" => "MS" , "Text" => "Montserrat" );
		$countryList[] = array( "Value" => "MT" , "Text" => "Malta" );
		$countryList[] = array( "Value" => "MU" , "Text" => "Mauritius" );
		$countryList[] = array( "Value" => "MV" , "Text" => "Maldives" );
		$countryList[] = array( "Value" => "MW" , "Text" => "Malawi" );
		$countryList[] = array( "Value" => "MX" , "Text" => "Mexico" );
		$countryList[] = array( "Value" => "MY" , "Text" => "Malaysia" );
		$countryList[] = array( "Value" => "MZ" , "Text" => "Mozambique" );
		$countryList[] = array( "Value" => "NA" , "Text" => "Namibia" );				 
		$countryList[] = array( "Value" => "NC" , "Text" => "New Caledonia" );
		$countryList[] = array( "Value" => "NE" , "Text" => "Niger" );
		$countryList[] = array( "Value" => "NF" , "Text" => "Norfolk Island" );
		$countryList[] = array( "Value" => "NG" , "Text" => "Nigeria" );
		$countryList[] = array( "Value" => "NI" , "Text" => "Nicaragua" );
		$countryList[] = array( "Value" => "NL" , "Text" => "Netherlands" );
		$countryList[] = array( "Value" => "NO" , "Text" => "Norway" );
		$countryList[] = array( "Value" => "NP" , "Text" => "Nepal" );
		$countryList[] = array( "Value" => "NR" , "Text" => "Nauru" );
		$countryList[] = array( "Value" => "NU" , "Text" => "Niue" );
		$countryList[] = array( "Value" => "NZ" , "Text" => "New Zealand" );
		$countryList[] = array( "Value" => "OM" , "Text" => "Oman" );
		$countryList[] = array( "Value" => "PA" , "Text" => "Panama" );
		$countryList[] = array( "Value" => "PE" , "Text" => "Peru" );
		$countryList[] = array( "Value" => "PF" , "Text" => "French Polynesia" );
		$countryList[] = array( "Value" => "PG" , "Text" => "Papua New Guinea" );	
		$countryList[] = array( "Value" => "PH" , "Text" => "Philippines" );
		$countryList[] = array( "Value" => "PK" , "Text" => "Pakistan" );
		$countryList[] = array( "Value" => "PL" , "Text" => "Poland" );
	//	$countryList[] = array( "Value" => "PM" , "Text" => "St Pierre & Miquelon" );
		$countryList[] = array( "Value" => "PN" , "Text" => "Pitcairn" );
		$countryList[] = array( "Value" => "PR" , "Text" => "Puerto Rico" );
		$countryList[] = array( "Value" => "PS" , "Text" => "Palestine" );
		$countryList[] = array( "Value" => "PT" , "Text" => "Portugal" );
		$countryList[] = array( "Value" => "PW" , "Text" => "Palau" );
		$countryList[] = array( "Value" => "PY" , "Text" => "Paraguay" );
		$countryList[] = array( "Value" => "QA" , "Text" => "Qatar" );
		$countryList[] = array( "Value" => "RE" , "Text" => "Reunion" );
		$countryList[] = array( "Value" => "RO" , "Text" => "Romania" );
		$countryList[] = array( "Value" => "RS" , "Text" => "Serbia" );
		$countryList[] = array( "Value" => "RU" , "Text" => "Russia" );
		$countryList[] = array( "Value" => "RW" , "Text" => "Rwanda" ); 
		$countryList[] = array( "Value" => "SA" , "Text" => "Saudi Arabia" );
		$countryList[] = array( "Value" => "SB" , "Text" => "Solomon Islands" );
		$countryList[] = array( "Value" => "SC" , "Text" => "Seychelles" );
		$countryList[] = array( "Value" => "SD" , "Text" => "Sudan" );
		$countryList[] = array( "Value" => "SE" , "Text" => "Sweden" );
		$countryList[] = array( "Value" => "SG" , "Text" => "Singapore" );
		$countryList[] = array( "Value" => "SH" , "Text" => "St Helena" );
		$countryList[] = array( "Value" => "SI" , "Text" => "Slovenia" );
	//	$countryList[] = array( "Value" => "SJ" , "Text" => "Svalbard & Jan Mayen" );
		$countryList[] = array( "Value" => "SK" , "Text" => "Slovakia" );
		$countryList[] = array( "Value" => "SL" , "Text" => "Sierra Leone" );
		$countryList[] = array( "Value" => "SM" , "Text" => "San Marino" );
		$countryList[] = array( "Value" => "SN" , "Text" => "Senegal" );
		$countryList[] = array( "Value" => "SO" , "Text" => "Somalia" );
		$countryList[] = array( "Value" => "SR" , "Text" => "Suriname" );
		$countryList[] = array( "Value" => "ST" , "Text" => "Sao Tome & Principe" );	
		$countryList[] = array( "Value" => "SV" , "Text" => "El Salvador" );
		$countryList[] = array( "Value" => "SY" , "Text" => "Syria" );
		$countryList[] = array( "Value" => "SZ" , "Text" => "Swaziland" );
		$countryList[] = array( "Value" => "TC" , "Text" => "Turks & Caicos Is" );
		$countryList[] = array( "Value" => "TD" , "Text" => "Chad" );
		$countryList[] = array( "Value" => "TF" , "Text" => "French Southern & Antarctic Lands" );
		$countryList[] = array( "Value" => "TG" , "Text" => "Togo" );
		$countryList[] = array( "Value" => "TH" , "Text" => "Thailand" );
		$countryList[] = array( "Value" => "TJ" , "Text" => "Tajikistan" );
		$countryList[] = array( "Value" => "TK" , "Text" => "Tokelau" );
		$countryList[] = array( "Value" => "TL" , "Text" => "East Timor" );
		$countryList[] = array( "Value" => "TM" , "Text" => "Turkmenistan" );
		$countryList[] = array( "Value" => "TN" , "Text" => "Tunisia" );
		$countryList[] = array( "Value" => "TO" , "Text" => "Tonga" );
		$countryList[] = array( "Value" => "TR" , "Text" => "Turkey" );
		$countryList[] = array( "Value" => "TT" , "Text" => "Trinidad & Tobago" );
	//	$countryList[] = array( "Value" => "TV" , "Text" => "Tuvalu" );
		$countryList[] = array( "Value" => "TW" , "Text" => "Taiwan" );
		$countryList[] = array( "Value" => "TZ" , "Text" => "Tanzania" );
		$countryList[] = array( "Value" => "UA" , "Text" => "Ukraine" );	
		$countryList[] = array( "Value" => "UG" , "Text" => "Uganda" );		
	//	$countryList[] = array( "Value" => "UM" , "Text" => "US minor outlying islands" );
		$countryList[] = array( "Value" => "US" , "Text" => "United States" );	
		$countryList[] = array( "Value" => "UY" , "Text" => "Uruguay" );	
		$countryList[] = array( "Value" => "UZ" , "Text" => "Uzbekistan" );	
	//	$countryList[] = array( "Value" => "VA" , "Text" => "Vatican City" );
		$countryList[] = array( "Value" => "VC" , "Text" => "St Vincent" );	
		$countryList[] = array( "Value" => "VE" , "Text" => "Venezuela" );	
	//	$countryList[] = array( "Value" => "VG" , "Text" => "Virgin Islands (UK)" );
		$countryList[] = array( "Value" => "VI" , "Text" => "Virgin Islands (US)" );	
		$countryList[] = array( "Value" => "VN" , "Text" => "Vietnam" );	
		$countryList[] = array( "Value" => "VU" , "Text" => "Vanuatu" );	
	//	$countryList[] = array( "Value" => "WF" , "Text" => "Wallis & Futuna" );
		$countryList[] = array( "Value" => "WS" , "Text" => "Samoa (western)" );	
		$countryList[] = array( "Value" => "YE" , "Text" => "Yemen" );	
	//	$countryList[] = array( "Value" => "YT" , "Text" => "Mayotte" );	
		$countryList[] = array( "Value" => "ZA" , "Text" => "South Africa" );	
		$countryList[] = array( "Value" => "ZM" , "Text" => "Zambia" );	
		$countryList[] = array( "Value" => "ZW" , "Text" => "Zimbabwe" );	
				 
		/**
		* Sort the array according to the Country Name first and then Country Code
		*/
		foreach ($countryList as $key => $row) {
			$code[$key]  = $row['Value'] ;
			$name[$key] = $row['Text'] ;
		}
		array_multisort($name, SORT_ASC, $code, SORT_ASC, $countryList) ;
		
		// Adding the Initail value ( Select )
		$countryList = array_merge(array(array( "Value" => "Select" , 
									"Text" => "Select" )),$countryList);
		
		/**
		* Bind the drop down list with the country values
		*/
		$this->CountryList->DataSource = $countryList ;
		$this->CountryList->dataBind() ;			
	}
	
	public function getCountryList() {
		$this->ensureChildControls();
		return $this->getRegisteredObject('CountryList');
	}
	public function setSkinID($value){
		$this->CountryList->SkinID = $value; 
	}
	public function setValidationGroup($value){
		$this->CountryList->ValidationGroup=$value;
	}
}
?>

 	
 	
 	
 	
